function DatabaseEntry(resource, datasource)
{
	this.resource = resource || null;
	this._datasource = datasource || null;	
	this.bag = datasource ? 
		Database.rdfContainerUtils.MakeBag(datasource, resource) :
		null;
}
DatabaseEntry.prototype.add = function DBE_add(resource) { this.bag.AppendElement(resource); }

DatabaseEntry.prototype.contains = function DBE_contains(resource) { 
	return (this.bag.IndexOf(resource) != -1); 
}

DatabaseEntry.prototype.containsByProperty = 
  	function DBE_containsByProperty(property, node) {
		var entries = this.bag.GetElements();
		while (entries.hasMoreElements()) {
			var entry = entries.getNext();
			if (entry instanceof CI.nsIRDFResource) {
				var target = this._datasource.GetTarget(entry, property, true);
				if (node.EqualsNode(target)) {
					return entry;
				}
			}
			else { 
				throw new TypeError();
			}
		}
		return null;
}
